/* 
 *   Date       Developer   Description
 *   
 *
 *   Classname:  org.apache.camel.component.custom.CustomEndpoint
 * 
 *   Date:   2014-3-3
 * 
 *   The source code contained in this listing is proprietary to
 *   HLJ POST YITONG INFO-NET CO.,LTD.
 * 
 *   Unauthorized copying, adaptation, distribution, use, or display
 *   is strictly prohibited.
 *   This software is Copyright 2014 HLJ POST YITONG INFO-NET CO.,LTD.
 */
package com.titan.demo.camel.developers.component;

import org.apache.camel.Component;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;

import com.titan.demo.camel.utils.LogUtils;


/**
 *
 *
 * @author Administrator
 *
 */
public class CustomEndpoint extends DefaultEndpoint {
    private String name;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }


    public CustomEndpoint(String endpointUri, Component component) throws Exception {
        super(endpointUri, component);
        LogUtils.log(CustomEndpoint.class, "CustomEndpoint", "endpointUri="+endpointUri);
    }
    
    
    @Override
    public Consumer createConsumer(Processor processor) throws Exception {
        LogUtils.log(CustomEndpoint.class, "createConsumer");
        CustomConsumer answer = new CustomConsumer(this, processor, getEndpointUri());
        configureConsumer(answer);
        return answer;
    }

    @Override
    public Producer createProducer() throws Exception {
        LogUtils.log(CustomEndpoint.class, "createProducer");
        return new CustomProducer(this, getEndpointUri());
    }

    protected void doStart() throws Exception {
        LogUtils.log(CustomEndpoint.class, "doStart");
    }
    
    @Override
    public boolean isSingleton() {
        return true;
    }

}

